-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backwards compatibility in findMatchingSimulator version input #23305
Backwards compatibility in findMatchingSimulator version input #23305
Conversation
…ewest xcrun to list devices. Format of xcrun output has changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues.
@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) { | |||
if (!version.includes('iOS') && !version.includes('tvOS')) { | |||
continue; | |||
} | |||
if (simulatorVersion && !version.endsWith(simulatorVersion)) { | |||
let versionWithDashReplacedByDot = version.replace(/-/g,'\.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier/prettier: Replace '\.')
with ·'.');
@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) { | |||
if (!version.includes('iOS') && !version.includes('tvOS')) { | |||
continue; | |||
} | |||
if (simulatorVersion && !version.endsWith(simulatorVersion)) { | |||
let versionWithDashReplacedByDot = version.replace(/-/g,'\.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semi: Missing semicolon.
@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) { | |||
if (!version.includes('iOS') && !version.includes('tvOS')) { | |||
continue; | |||
} | |||
if (simulatorVersion && !version.endsWith(simulatorVersion)) { | |||
let versionWithDashReplacedByDot = version.replace(/-/g,'\.') | |||
if (simulatorVersion && !versionWithDashReplacedByDot.endsWith(simulatorVersion)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier/prettier: Replace simulatorVersion·&&·!versionWithDashReplacedByDot.endsWith(simulatorVersion)
with ⏎······simulatorVersion·&&⏎······!versionWithDashReplacedByDot.endsWith(simulatorVersion)⏎····
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues.
@@ -44,7 +44,8 @@ function findMatchingSimulator(simulators, simulatorString) { | |||
if (!version.includes('iOS') && !version.includes('tvOS')) { | |||
continue; | |||
} | |||
if (simulatorVersion && !version.endsWith(simulatorVersion)) { | |||
let versionWithDashReplacedByDot = version.replace(/-/g,'\.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier/prettier: Replace '\
with ·'
Thanks for making us aware of this issue. I noticed that we already had this fix in the newer version of the CLI that was extracted, so I decided to just backport that one and push it to the 0.58 branch. |
Summary
handling dot-version input in findMatchingSimulator also when using newest xcrun to list devices. Format of xcrun output has changed
When parsing simulator names in order to run on iOS simulator, the version provided by xcrun now is separated by a dash instead of a dot. Therefore when input to run-ios --simulator is specified with an iOS version (in dot-format), the simulator will not be found.
This started happening for me after I installed the latest XCode (beta). I am currently using XCode "Version 10.2 beta (10P82s)", but I have tried using xcode-select to point towards the latest stable XCode version as well, but the problem still occurs. My version of xcrun is "xcrun version 43.1."
Changelog
[iOS] [Changed] - Backwards compatibility in input format for run-ios --simulator "<device-type (device-version)>"
Test Plan
Run the command "react-native run-ios --simulator "iPhone X (12.2)". Without the fix I get the error
Could not find iPhone X simulator
With the fix, it starts fine (Assuming you have an iPhone X 12.2 simulator installed on your machine.)